package com.mydemo.proxy;

import com.mydemo.proxy.impl.DemoServiceImpl;

import java.lang.reflect.Proxy;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: JDKInvocationHandlerTest, v1.0 2019-09-10 17:56 liming1 Exp $
 */
public class JDKInvocationHandlerTest {
    public static void main(String[] args) {
        DemoService demoService = new DemoServiceImpl();
        JDKInvocationHandler myInvocationHandler = new JDKInvocationHandler(demoService);
        DemoService o = (DemoService) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{DemoService.class}, myInvocationHandler);
        o.test();
    }
}
